package com.gaoyubo.service;

import com.gaoyubo.dao.UserDao;
import com.gaoyubo.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class UserServiceImpl implements UserService{
    @Autowired
    private UserDao userDao;
    @Override
    public List<User> getList() {
        return userDao.findAll();
    }
    @Override
    public Optional<User> findById(Integer id) {
        return userDao.findById(id);
    }
    @Override
    public void deleteById(Integer id) {
        userDao.deleteById(id);
    }
    @Override
    public <S extends User> S saveAndFlush(S s) {
        return userDao.saveAndFlush(s);
    }
    @Override
    public Optional<User> findByName(String name) {
        return userDao.findByName(name);
    }
}
